package com.anxin.baseproject2.modle;

import android.content.Context;

import com.anxin.baseproject2.modle.manager.AClient;
import com.hzz.common.util.DisplayUtil;
import com.hzz.common.util.PreferenceUtil;
import com.hzz.common.util.ToastUtil;

/**
 * Created by Huang、 on 2017/4/20.
 */
public class AppHelper {
    private static AppHelper instance;
    private static Context mContext;
    private AppHelper(){
        init();
    }

    public AppHelper getInstance(){
        synchronized (AppHelper.class) {
            if (instance == null) {
                synchronized (AppHelper.class) {
                    if (instance == null) {
                        instance = new AppHelper();
                    }
                }
            }
        }
        return instance;
    }


    public static void setContext(Context context){
        mContext=context;
    }

    public void init(){
        AClient.init(mContext);

        //初始化所有工具类
        initUtils();
    }


    /**
     * 初始化工具
     */
    private void initUtils(){
        PreferenceUtil.init(mContext);
        DisplayUtil.init(mContext);
        ToastUtil.init(mContext);
    }
}
